package com.open.cloud.rbac.service.application.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.open.cloud.rbac.entity.application.CoreApplicationModule;
import com.open.cloud.rbac.mapper.application.CoreApplicationModuleMapper;
import com.open.cloud.rbac.service.application.ICoreApplicationModuleService;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 应用模块表 服务实现类
 * </p>
 *
 * @author wangzengzhou01
 * @since 2024-12-23
 */
@Service
public class CoreApplicationModuleServiceImpl extends ServiceImpl<CoreApplicationModuleMapper, CoreApplicationModule>
        implements ICoreApplicationModuleService {

    @Resource
    private CoreApplicationModuleMapper appModuleMapper;

    /**
     * 根据AppId获取模块列表
     *
     * @param appId
     * @return
     */
    @Override
    public List<CoreApplicationModule> getAppModuleByAppId(String appId) {
        LambdaQueryWrapper<CoreApplicationModule> queryWrapper = Wrappers.<CoreApplicationModule>lambdaQuery()
                .eq(ObjectUtils.isNotEmpty(appId), CoreApplicationModule::getApplicationId, appId);
        List<CoreApplicationModule> moduleList = appModuleMapper.selectList(queryWrapper);
        return moduleList;
    }
}
